/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
// -*- coding:iso-8859-15 mode: c++ -*-
/** 
 * \file
 * \brief MaCI_Image Image header
 * \author Matthieu Myrsky <matthieu.myrsky@tkk.fi>
 *
 * $Id$
 *
 */
#ifndef _IMAGELOGGER_HPP_
#define _IMAGELOGGER_HPP_
#include <string>
#include <vector>
#include "Logger.hpp"
#include "owndebug.h"
#include "ownutils.h"
#include "ImageClient.hpp"
#include <sys/stat.h>
class ImageLogger: private gim::CSync, 
                   private gim::CThread,
                   public Logger

{
public:

  /**
   * Constructor
   * 
   * @param 
   */
  ImageLogger(MaCI::Image::CImageClient *aClient,
                 std::string aMaCISLName);
   

  /**
   * Destructor
   */
  virtual ~ImageLogger();

  /**
   * Starts logging selected type(s)
   *
   * @return      True if logging started, else false
   */
  bool StartLogging(void);

  /**
   * Stops logging selected type(s)
   *
   * @return      True if logging started, else false
   */
  bool StopLogging(void);

  std::string GetName(void);

  

  bool GetAdditionalInformation(std::string &aInformation);

  bool SkipNMeasurements(unsigned int aN);
  bool SupportMeasurementSkipping(){ return true;}
private:
  MaCI::Image::CImageClient *iIClient;
  bool iRunning;
  bool iRunningThreadStopped;
  char iPathName[256];  
  char iDirectory[256];
  FILE *iFile;
  std::string iMaCISLName;
  std::string iAdditionalInformation;
  unsigned int iNumberToSkip;
  int ThreadFunction(const int aThreadNumber);
  
  ImageLogger(const ImageLogger&):
    CSync(1, 1),               
    CThread(1),                
    Logger(),
    iIClient(NULL),
    iRunning(false),
    iRunningThreadStopped(true),
    iPathName(),
    iDirectory(),
    iFile(NULL),
    iMaCISLName(""),
    iAdditionalInformation(""),
    iNumberToSkip(0)

  {}

  ImageLogger &operator=(const ImageLogger&){return *this;}
 
};
#endif
